package com.itheima.recurse;

public class RecurseDemo3 {
    public static void main(String[] args) {
        // 5! = 5 * 4 * 3 * 2 * 1
        int result = getFactorial(5);
        System.out.println(result);
    }

    private static int getFactorial(int i) {
        if (i == 1) {
            return 1;
        } else {
            return i * getFactorial(i - 1);
        }
    }
}
